
let id = 0
class Dep {
  constructor() {
    this.subs = [];
    this.id = id++;
  }
  addSub(watcher) {
    this.subs.push(watcher)
  }
  notify() {
    this.subs.forEach(watcher => watcher.update())
  }

  depend() {
    Dep.target.addDep(this)
  }
}

export default Dep;